www.gusucode.com > 组态王 VC++ 组态软件源码源码程序 > 组态王 VC++ 组态软件源码/组态王6.5/组态王6.5/zutai5/wyMeterPpg.cpp

    // wyMeterPpg.cpp : Implementation of the CwyMeterPropPage property page class.

#include "stdafx.h"
#include "Meter.h"
#include "wyMeterPpg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


IMPLEMENT_DYNCREATE(CwyMeterPropPage, COlePropertyPage)


/////////////////////////////////////////////////////////////////////////////
// Message map

BEGIN_MESSAGE_MAP(CwyMeterPropPage, COlePropertyPage)
	//{{AFX_MSG_MAP(CwyMeterPropPage)
	ON_BN_CLICKED(IDC_BUTTON_COLOR, OnButtonColor)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid

IMPLEMENT_OLECREATE_EX(CwyMeterPropPage, "METER.wyMeterPropPage.1",
	0x15491a66, 0x5b63, 0x11d5, 0xad, 0xd3, 0, 0x10, 0x88, 0xab, 0x5d, 0x33)


/////////////////////////////////////////////////////////////////////////////
// CwyMeterPropPage::CwyMeterPropPageFactory::UpdateRegistry -
// Adds or removes system registry entries for CwyMeterPropPage

BOOL CwyMeterPropPage::CwyMeterPropPageFactory::UpdateRegistry(BOOL bRegister)
{
	if (bRegister)
		return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
			m_clsid, IDS_WYMETER_PPG);
	else
		return AfxOleUnregisterClass(m_clsid, NULL);
}


/////////////////////////////////////////////////////////////////////////////
// CwyMeterPropPage::CwyMeterPropPage - Constructor

CwyMeterPropPage::CwyMeterPropPage() :
	COlePropertyPage(IDD, IDS_WYMETER_PPG_CAPTION)
{
	//{{AFX_DATA_INIT(CwyMeterPropPage)
	// NOTE: ClassWizard will add member initialization here
	//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_DATA_INIT
}


/////////////////////////////////////////////////////////////////////////////
// CwyMeterPropPage::DoDataExchange - Moves data between page and properties

void CwyMeterPropPage::DoDataExchange(CDataExchange* pDX)
{
	//{{AFX_DATA_MAP(CwyMeterPropPage)
	DDP_Text(pDX, IDC_EDIT_COLOR, m_colorNeedle, _T("colorNeedle") );
	DDX_Text(pDX, IDC_EDIT_COLOR, m_colorNeedle);
	DDP_Text(pDX, IDC_EDIT_UNIT, m_strUnits, _T("strUnits") );
	DDX_Text(pDX, IDC_EDIT_UNIT, m_strUnits);
	DDP_Text(pDX, IDC_EDIT_MAX, m_dMaxValue, _T("dMaxValue") );
	DDX_Text(pDX, IDC_EDIT_MAX, m_dMaxValue);
	DDP_Text(pDX, IDC_EDIT_MIN, m_dMinValue, _T("dMinValue") );
	DDX_Text(pDX, IDC_EDIT_MIN, m_dMinValue);
	DDP_Text(pDX, IDC_EDIT_SCAL, m_nScaleDecimals, _T("nScaleDecimals") );
	DDX_Text(pDX, IDC_EDIT_SCAL, m_nScaleDecimals);
	DDP_Text(pDX, IDC_EDIT_DATA, m_nValueDecimals, _T("nValueDecimals") );
	DDX_Text(pDX, IDC_EDIT_DATA, m_nValueDecimals);
	//}}AFX_DATA_MAP
	DDP_PostProcessing(pDX);
}


/////////////////////////////////////////////////////////////////////////////
// CwyMeterPropPage message handlers

void CwyMeterPropPage::OnButtonColor() 
{
	long m_Color;
	char p1[15];
	CColorDialog ColorDlgBox(0,0,this);
	if (ColorDlgBox.DoModal()==IDOK)
	{
		m_Color=ColorDlgBox.GetColor();
		sprintf(p1,"%d",m_Color);
		SetDlgItemText(IDC_EDIT_COLOR,p1);
	}	
}